package com.study.demo_restful.dao;

import com.study.demo_restful.bean.User;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.repository.query.Param;
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
import org.springframework.data.rest.core.annotation.RestResource;
import org.springframework.web.bind.annotation.CrossOrigin;

import java.util.List;

/**
 * @ClassName: UsersDao
 * @Description:
 * @author: WS
 * @date 2020/12/22
 * @Version: 1.0
 **/
@CrossOrigin
@RepositoryRestResource(path="us",collectionResourceRel="us",itemResourceRel="u")
public interface UserDao extends JpaRepository<User,Integer> {
    @RestResource(path="byName",rel="byname")
    public List<User> findByNameContaining(@Param("name")String name);
    public List<User> findByAgeBetween(@Param("start")int start,@Param("end")int end);
}
